package com.test.springboot_test.stringTest;

public class SpringTest12 {
    public static void main(String[] args) {

        /**
         * 字符串基本操作
         * 截取、拼接、分割、索引
         */

        String a ="1+1=@2";
        System.out.println(a.substring(0, a.lastIndexOf("@")));
        System.out.println(a.substring(a.lastIndexOf("@")+1));

        String b[]={"a","b","c"};
        StringBuilder builder = new StringBuilder();
        for(String a1 : b){
            builder.append(a1);
        }
        System.out.println(builder.toString());

        //分割
        String str3 ="1,2,3,4,5,6";
        String[] split = str3.split(",");
        for(String a1 : split){
            System.out.println(a1);
        }

        //索引
        String str4 ="1,2,3,4,5,6";
        System.out.println(str4.indexOf(","));
        System.out.println(str4.lastIndexOf(","));


    }


}
